<template>

<table  class="table table-broder">
            <thead>

                <tr>

                <th>RankRights_Id</th>
                <th>MR_Name</th>
                <th>Rank_Name</th>
                <th>操作</th>
                </tr>


            </thead>

            <tbody>

  <tr v-for="item in aa">

<th>{{ item.RankRights_Id }}</th>
<th>{{ item.MR_Name }}</th>
<th>{{ item.Rank_Name }}</th>
<th>
        <button @click="DelH(item.RankRights_Id)" >删除</button>
        <a href="#" @click="Xg(item.RankRights_Id)">修改</a>

</th>
</tr>




            </tbody>




</table>






</template>


<script setup lang="ts">
import axios from 'axios';
import { onMounted } from 'vue';

import {ref} from 'vue';

import {useRouter,createRouter} from 'vue-router'

onMounted(()=>{
    Show();

})


const aa =ref([{

    RankRights_Id: 0,
    Rank_Id: -1,
    MR_Id: -1,
    MR_Name: "string",
    Rank_Name: "string",
    IsDel: true


}])


const Show=()=>{


        axios.get('https://localhost:7035/api/Hight/ShowHi').then(res=>{

            aa.value=res.data
        })


}



const DelH=(id:number)=>{

        axios.delete('https://localhost:7035/api/Hight/IsDelHi?id='+id).then(res=>{

            if(res.data>0)
        {

            alert('删除成功')
            Show();
        }
        else
        {
            alert('删除失败')
        }
        })


}



const router =useRouter()


const Xg=(id:number)=>{

  
    router.push({
            name:"XgH",
          params:{
            Hid:id
          }


    })





}


</script>